home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / nurbsRatioConvert.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.1 KB  |  53 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  13 Sep 2000
  22. //  Author: lli, adelong
  23. //
  24. //  Procedure Name:
  25. //      nurbsRatioConvert
  26. //
  27. //  Description:
  28. //        A tool used for converting from a ratio to a value (and vice versa) in NURB creation
  29. //        (e.g. given a radius and a ratio of height-to-radius, this can calculate the height itself)
  30. //
  31. //        If the "Create Nurbs" dialogs are changed so that they take ratios as inputs
  32. //        for "Height" and "Length" etc., then this procedure can be changed to just return $ratioArg
  33. //        and all the appropriate optionVars will be set.
  34. //
  35. //  Input Arguments:
  36. //        $isCalcRatio indicates whether to return the product of the two arguments (false)
  37. //        or to return the ratio between them (true)
  38. //
  39. //        $baseValue is the value that the ratio depends on (e.g. radius)
  40. //
  41. //  Return Value:
  42. //      If $isCalcRatio is true, then the ratio of $ratioArg to $baseValue is returned.
  43. //    Otherwise it returns the product of $baseValue and $ratioArg
  44. //
  45. global proc float nurbsRatioConvert (float $baseValue, float $ratioArg, int $isCalcRatio) {
  46.  
  47.     if ($isCalcRatio == false) {
  48.         return($baseValue * $ratioArg);
  49.     } else if ($baseValue != 0) {
  50.         return($ratioArg / $baseValue);
  51.     }
  52.     return(0);
  53. }